package cn.shyouchi.wuguanjia.android.ui.event.checkpoint;

import android.view.View;

import com.chad.library.adapter.base.BaseItemDraggableAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/11/17 at 17:24
 * Email: 472279981@qq.com
 * Des:
 */

public class CheckPointAdapter extends BaseItemDraggableAdapter<CheckPointEntity.ResultMessageBean, BaseViewHolder> {

    CheckPointContract.View mView;

    public CheckPointAdapter(List<CheckPointEntity.ResultMessageBean> data, CheckPointContract.View view) {

        super(R.layout.item_event_check_point_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final CheckPointEntity.ResultMessageBean bean) {
        holder.setText(R.id.tv_point_name, bean.getInspectionname());
        holder.setText(R.id.tv_rank_point_mode, bean.getInspectionmethod() == 1 ? "二维码" : "拍照");

        holder.setText(R.id.tv_check_num, String.valueOf(holder.getAdapterPosition() + 1));

//        holder.getView(R.id.btn_del).setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                mView.onDelClick(bean);
//            }
//        });

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mView.onItemClick(bean);
            }
        });
    }
}
